<?php


namespace app\api\controller;


use app\service\model\MemberCouponModel;
use app\service\model\MemberModel;
use app\service\model\OrderModel;
use app\service\Y;

class Member extends AuthApi
{

    /**
     * 用户信息
     * @return \think\response\Json
     */
    public function member_info(): \think\response\Json
    {
        $member_info = $this->member;
        $coupon_num = MemberCouponModel::where('member_id', '=', $member_info->id)->where('status', '=', 1)->count();
        $order_num = OrderModel::where('member_id', '=', $member_info->id)->count();
        return Y::success(compact('member_info', 'coupon_num', 'order_num'), '用户信息');
    }
}